package protocbuf;


import com.google.protobuf.InvalidProtocolBufferException;
import protocbuf.protoc.DataInfo;

public class ProtocBufTest {

    public static void main(String[] args) throws InvalidProtocolBufferException {
        DataInfo.Student student = DataInfo.Student.newBuilder()
                .setName("张三")
                .setAge(18)
                .setAddress("Austria")
                .build();

        byte[] bytes = student.toByteArray();

        DataInfo.Student student1 = DataInfo.Student.parseFrom(bytes);

        System.out.println(student1);
        System.out.println(student1.getName());
    }
}
